package com.firebird.app.fekpsl.ui.fragment

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment

import com.firebird.app.fekpsl.R
import com.firebird.app.fekpsl.ui.activity.classroom.InitiationCourseActivity
import com.firebird.app.fekpsl.ui.activity.classroom.OnlineCourseActivity
import com.firebird.app.fekpsl.ui.activity.classroom.QuestionPracticeActivity
import com.firebird.app.fekpsl.ui.activity.classroom.SelfAnalysisActivity
import com.firebird.app.fekpsl.ui.activity.sword.VideoCourseActivity
import kotlinx.android.synthetic.main.fragment_classroom.*

/**
 * A simple [Fragment] subclass.
 */
class ClassroomFragment :  Fragment() {

    companion object {
        fun getInstance(): ClassroomFragment = ClassroomFragment()
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                              savedInstanceState: Bundle?): View? {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_classroom, container, false)
    }

    override fun onDetach() {
        super.onDetach()
    }
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        //initView()
        initListener()
    }
    private fun initListener(){
        mInitiationCourse.setOnClickListener {
            Intent(activity, InitiationCourseActivity::class.java).run {
                startActivity(this)
            }
        }
        mOnlineCourse.setOnClickListener {
            Intent(activity, OnlineCourseActivity::class.java).run {
                startActivity(this)
            }
        }
        mVideoCourse.setOnClickListener {
            Intent(activity, VideoCourseActivity::class.java).run {
                startActivity(this)
            }
        }
        mQuestionPractice.setOnClickListener {
            Intent(activity, QuestionPracticeActivity::class.java).run {
                startActivity(this)
            }
        }
        mSelfAnalysis.setOnClickListener {
            Intent(activity, SelfAnalysisActivity::class.java).run {
                startActivity(this)
            }
        }
    }

    interface OnFragmentInteractionListener {
        // TODO: Update argument type and name
        fun onFragmentInteraction(uri: Uri)
    }

}
